<?php
require_once './include/common.inc.php';
function mb_mime_header($string, $encoding=null, $linefeed="\r\n") {
  if(!$encoding) $encoding = mb_internal_encoding();
  $encoded = '';

   $encoded .= "=?$encoding?B?"
             . base64_encode($string)
             . "?=$linefeed";
  return $encoded;
}
function send($from_name,$from_email,$to_name,$to_email,$subject,$content){
    //$to_email => name1@domain.com,name2@domain.com;
    if (strstr($to_email, ",")) {
        $tmp_ary = explode(",", $to_email);
        foreach ($tmp_ary as $v) {
            $tmp_ary2[] = mb_mime_header($to_name, "iso-8859-1")."<$v>";
        }
        $to = implode(",", $tmp_ary2);

    } else {
        $to   =  mb_mime_header($to_name, "iso-8859-1")."<$to_email>";
    }
//$to=mb_mime_header($to, "iso-8859-1");
$mime = "MIME-Version: 1.0\n";
$mime .= "Content-type: text/html; charset=iso-8859-1\n"; 
$mime .= "From:" . mb_mime_header($from_name, "iso-8859-1") . " <$from_email>\n";
$mime .= "X-Mailer:PHP\n";
$mime .= "X-Priority:2\n";
$mime .= "Content-Transfer-Encoding: 7bit";

$subject = mb_mime_header($subject, "iso-8859-1");

	
    //?'
    //$mime = "From: $from_name <$from_email>\nX-Mailer:PHP\nX-Priority:2\nContent-Type: text/html; charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\nMIME-Version: 1.0";
	//$mime = "MIME-Version: 1.0\nContent-Type: text/html; charset=iso-8859-1\nFrom: $from_name <$from_email>\nX-Mailer:PHP\nX-Priority:2\nContent-Transfer-Encoding: 8bit";
    @mail($to,$subject,$content,$mime) or die("<h2 align=\"center\">Something must wrong, please contact the webmaster.</h2>");

}
$cid=10035;
$sql_promoter="select firstname,lastname,password2,email,rank from promoter_info where id=".$cid;
$ary_promoter=$mysql->fetch($sql_promoter);

$firstname=$ary_promoter[0]["firstname"];
$lastname=$ary_promoter[0]["lastname"];
$username=$firstname." ".$lastname;
$password=$ary_promoter[0]["password2"];
$email=$ary_promoter[0]["email"];
$rank=$RANK_ARY[$ary_promoter[0]["rank"]];
$promoterid=$cid;


include_once('./mail/approval_promoter.php');
send($from_name,$from_email,$to_name,$to_email,$subject,$content);


?>
<a href="test.php">link</a>